//
//  CTVMediaDownload.h
//  Channltv
//
//  Created by Bruno Keymolen on 13/10/07.
//  Copyright 2007 channl.tv. All rights reserved.
// 
#import <Cocoa/Cocoa.h>
#import "CTVClip.h"

@class CTVMediaDownload, CTVMediaDownloadUpdate, CTVMediaDownloadReply;

//Intended for the Media object creator
@protocol CTVMediaDownloadReply
	-(int)finishMediaDownload:(CTVMediaDownload*)mediaDownload;
	-(int)releaseMediaDownload:(CTVMediaDownload*)mediaDownload;
@end

//Intended for anyone interested in Media events 
@protocol CTVMediaDownloadUpdate
	-(void)downloadPercent:(int)pc;
	-(void)downloadTimeLeft:(int)tl;
	-(void)downloadFinish;
	-(void)downloadError:(int)errorcode;
@end



//Class definition
@interface CTVMediaDownload : NSObject {
	CTVMediaDownloadReply* m_mediaReply;
	NSMutableArray* m_downloadUpdates; //CTVMediaDownloadUpdate*
	CTVClip* m_clip;
}

-(id)initWithClip:(CTVClip*)clip andMediaReply:(CTVMediaDownloadReply*)mediaReply;
-(void)dealloc;
-(void)addDownloadUpdate:(CTVMediaDownloadUpdate*)update;
-(void)removeDownloadUpdate:(CTVMediaDownloadUpdate*)update;

@end

//Abstract members
@interface CTVMediaDownload (Abstract)
	-(NSString*)urlString;
	-(int)httpStatusCode;
@end
